"""
7-3 币值转换
输入一个整数（位数不超过9位）代表一个人民币值（单位为元），请转换成财务要求的大写中文格式。
如23108元，转换后变成“贰万叁仟壹百零捌”元。为了简化输出，
用小写英文字母a-j顺序代表大写数字0-9，
用S、B、Q、W、Y分别代表拾、百、仟、万、亿。
于是23108元应被转换输出为“cWdQbBai”元。

本质上是一种按照规则来构造字符串
暂时没有很完善的思路
说明在对字符串的处理上我的思路有缺陷
"""


# 想不下去的半成品
def resolution1():
    numbers = ["a", "b", "c", "d", "e",
               "f", "g", "h", "i", "j"]
    scales = ["S", "B", "Q", "W", "Y"]
    money = input()
    length = len(money)
    int_money = int(money)
    result_str = ""
    first = second = third = ""
    third = str(int_money % 10000)
    second = str(int(int_money / 10000) % 10000)
    first = int(money[0])
    if length == 9:
        result_str += numbers[first] + "Y"
        result_str += (numbers[int(second[0])] + "Q"
                       + numbers[int(second[1])] + "B"
                       + numbers[int(second[2])] + "S"
                       + numbers[int(second[3])] + "W")
        result_str += (numbers[int(third[0])] + "Q"
                       + numbers[int(third[1])] + "B"
                       + numbers[int(third[2])] + "S"
                       + numbers[int(third[3])])
        pass
    elif 4 < length <= 8:
        pass
    elif length <= 4:
        pass
    # 输入结果字符串
    print(result_str)
    # print(first)
    # print(second)
    # print(third)


def resolution2():
    # 定义数字和单位的映射
    numbers = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    units = ['', 'S', 'B', 'Q', 'W', 'S', 'B', 'Q', 'Y']
    
    num = int(input())
    # 将输入的数字转换为字符串，便于处理
    num_str = str(num)

    # 初始化结果字符串
    result = ''

    # 用来标记是不是连续的零的情况
    flag = 0
    length = len(num_str)

    # 从高位到低位遍历数字的每一位
    for i in range(length):
        # 获取当前位的数字
        digit = int(num_str[i])
        # 获取当前位的单位
        unit = units[length - i - 1]
        # 如果当前位的数字不为0，则正常操作将添加到结果字符串
        if digit != 0:
            result += numbers[digit] + unit
            flag = 0
        elif digit == 0:
            if flag == 0 and i != length-1:
                result += numbers[digit]
                flag = 1
            elif flag:
                if i == length-1:
                    result = result[:length-1]
                # 还剩最后一个测试点： 不超过亿，中间连续多0 这时候的W就不能省去了。
                if unit == 'Q':
                    # 在连续0的情况下，它又是千位的零，说明万位是零，千位也是零，这时候得补上一个万
                    result = result[:i]
                    result += 'Wa'
                    
    # 最小个位数
    if num == 0:
        result = 'a'
    print(result)


if __name__ == '__main__':
    resolution2()